#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int partitionArray(vector<int>& nums, int k) {
        int res = 1;
        ranges::sort(nums);
        int left = nums[0];
        for (auto& e : nums)
        {
            if (e - left > k)
            {
                ++res;
                left = e;
            }
        }
        return res;
    }
};